<template>
    <div class="search">
        <!-- 头部导航栏 -->
        <div class="head">
            <h3>食谱秀网</h3>
            <svg class="icon icon-caidan" aria-hidden="true" @click="show = !show">
                <use xlink:href="#icon-caidan"></use>
            </svg>
            <!-- 头部隐藏栏 -->
            <transition name="fade">
                <ul class="tab" v-if="!show">
                    <router-link to="/index">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-icons_statistics"></use>
                                </svg>
                                首页
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/classify">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-tag"></use>
                                </svg>
                                食材分类
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/Cookbook">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-tag"></use>
                                </svg>
                                菜谱大全
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/HomeCooked">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-tag"></use>
                                </svg>
                                家常菜谱
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/restriction">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-star"></use>
                                </svg>
                                食物相克
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/PregnantDiet">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-tag"></use>
                                </svg>
                                孕妇食谱
                            </span>
                        </li>
                    </router-link>
                    <router-link to="/FoodInformation">
                        <li>
                            <span>
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#icon-tag"></use>
                                </svg>
                                美食资讯
                            </span>
                        </li>
                    </router-link>
                </ul>
            </transition>
        </div>
        <!-- 搜索 -->
        <div class="sousuo">
            <svg class="icon icon-fangdajing" aria-hidden="true">
                <use xlink:href="#icon-fangdajing1"></use>
            </svg>
            <input type="text" class="sousuo1" placeholder="面食的做法大全">
            <router-link to="/search">
                <input type="submit"  class="sousuo2" value="搜索">
            </router-link>
            <p>位置： 首页 > 食谱分类 > 面食的做法大全</p>
        </div>
        <!-- 面食的做法大全 -->
        <h3 class="title">面食的做法大全</h3>
        <ul class="foods">
            <li v-for="(item,index) in noodles" :key="index">
                <router-link to="/index">
                    <img :src="item.src" alt="">
                    <p>{{item.name}}</p>
                </router-link>
            </li>
        </ul>
        <!-- 按钮切换 -->
        <div class="change">
            <button>首页</button>
            <button>上一页</button>
            <button>下一页</button>
            <button>尾页</button>
        </div>
        <!-- 推荐部分 -->
        <div class="recommend">
            <li v-for="(item,index) in recommend" :key="index">
                <router-link to="/index">
                    <img :src="item.src" alt="">
                    <p>{{item.explanation}}</p>
                </router-link>
            </li>
        </div>
        <!-- 热门标签 -->
        <h3 class="title tip">热门标签</h3>
        <ul class="food">
            <li v-for="(item,index) in HomeCooked2" :key="index">
                <router-link to="/classify" style="text-decoration:none;">
                    <p>{{item}}</p>
                </router-link>
            </li>
        </ul>
        <!-- 底部  -->
        <div class="foot">
            Copyright 食谱秀 m.shipuxiu.com <br>
            <p> 
                官方微信号: <span style="color: #ff0000;">chaoliu1588 </span> 
                <router-link to="https://m.shipuxiu.com/fenlei/">食谱分类</router-link>
                <router-link to="https://support.qq.com/products/113359/">我要吐槽</router-link>
                <router-link to="https://new.cnzz.com/v1/login.php?siteid=5433565">站长统计 </router-link>
             </p> 
        </div>
    </div>
</template>

<script>
export default {
    data(){
        return{
            show:true,
            noodles:[],
            recommend:[],
            HomeCooked2:[]
        }
    },
    mounted(){
        // 获取数据
        this.$http.get('../../data/data.json')
        .then((response)=> {
            this.recommend = response.data.recommend
            this.noodles = response.data.noodles            
            this.HomeCooked2 = response.data.HomeCooked2
        })
        .catch(function (error) {
            console.log(error);
        })
        .then(function () {
            // always executed
        });
    }
}
</script>

<style scoped>
    /* 搜索 */
    .sousuo{
        height: 10vh;
        color: #333333;
    }
    /* 面食的做法大全 */
    .title{
        margin-top: 10px;
        color: #ff5a5a;
        margin-left: 10px;
        font-size: 16px;
    }
    .foods{
        margin-top: 10px;
        width: 100%;
        height: 217vh;
        border-top: 2px solid #f0f0f0;
        padding-top: 10px;
    }
    .foods li{
        width: 45%;
        height: 5vh;
    }
    .foods li img{
        width: 82%;
        height: 14vh;
        margin-left: 20px;
    }
    .foods li p{
        font-size: 14px;
        text-align: center;
        color: #333333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* 按钮切换 */
    .change{
        margin-top: -20px;
    }
    /* 推荐部分 */
    .recommend{
        margin-top: -60px;
    }
    /* 热门标签 */
    .food{
        margin-top: 10px;
        width: 100%;
        border-bottom: 1px solid #f4f4f4;
        height: 35vh;
        background: #ffffff;
        border-top: 1px solid #f1f1f1;
        padding-top: 10px;
    }
    .food li{
        height: 5vh;
        background: #eeeeee;
        border-radius: 20px;
        margin-bottom: 15px;
        
    }
    .food li p{
        font-size: 12px;
        text-align: center;
        color: #333333;
        line-height: 5vh;
        margin: 0px 10px;
    }
    .tip{
        color: #f67521;
        font-size: 18px;
        font-weight: 540;
    }
    .foot{
        border: 1px solid #cccccc;
        height: 7vh;
    }
</style>

